/*
 * @Descripttion:
 * @version: 1.0.0
 * @Author: QianChao
 * @Date: 2024-04-25 13:40:50
 */

import i18n from 'i18next';
import { useCommandManager, type BaseCommand } from '@amcax/base';

interface IProps {
  cmd: BaseCommand;
  env: string;
}

function EnvButton({ cmd, env }: IProps) {
  const { invokeCmd } = useCommandManager();

  const envClass =
    'w-1/2 h-full flex justify-center items-center bg-primary text-white rounded-full';
  const normalClass =
    'w-1/2 h-full flex justify-center items-center cursor-pointer';

  return (
    <div
      className='flex justify-center items-center w-[152px] h-[42px] rounded-full 
        bg-[#f5f5f5] p-1 absolute top-1/2 -mt-[21px] z-[100] right-0 text-[16px]'
      style={{
        boxShadow: '0px 0px 3px 0px rgba(0, 0, 0, 0.20) inset',
      }}>
      <div
        className={env !== 'curved' ? envClass : normalClass}
        onClick={env === 'curved' ? () => invokeCmd(cmd) : () => {}}>
        {i18n.t('特征')}
      </div>
      <div
        className={env === 'curved' ? envClass : normalClass}
        onClick={env !== 'curved' ? () => invokeCmd(cmd) : () => {}}>
        {i18n.t('曲面')}
      </div>
    </div>
  );
}

export default EnvButton;
